package com.example.a22310.yuejian09.Activity;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.example.a22310.yuejian09.Fragment.LeagueFragment;
import com.example.a22310.yuejian09.R;
//登陆页
public class LoginActivity extends AppCompatActivity {
    private Button btn_login;
    private  Button btn_zc;
    private EditText uname,pword;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        btn_login = findViewById(R.id.btn_login);
        btn_zc = findViewById(R.id.btn_zc);
        uname = findViewById(R.id.et_username);
        pword = findViewById(R.id.et_password);
        //点击注册（跳转到注册界面）
        btn_zc.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(LoginActivity.this,
                        RegisterActivity.class);
                startActivity(intent);//执行点击事件
            }
        });
        //点击登陆(跳转到主界面）
        btn_login.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //获取控件的值
                 Intent intent = new Intent(LoginActivity.this,
                         LeagueFragment.class);
                 intent.putExtra("username",
                         uname.getText().toString());
                intent.putExtra("password",
                        pword.getText().toString());
                startActivity(intent);//执行点击事件


            }
        });


    }
}
